#include<bits/stdc++.h>

using i64 = long long;
using pii = std::pair<int, int>;

namespace std {
int __lg(int n) {
    return 31 - __builtin_clz(n);
}
}

#include <bit>
namespace std {
int bit_width(int n) {
    return 32 - __builtin_clz(n);
}
}

template <typename T, typename F>
struct ST {
    int n;
    std::vector<std::vector<T>> a;
    F func;
    
    ST(const std::vector<T> &v, F f) : n(v.size()), func(f) {
        init(v);
    }
    void init(const std::vector<T> &v) {
        int lg = std::__lg(n);
        a.assign(lg + 1, std::vector<T> (n));
        
        a[0] = v;
        for (int i = 0; i < lg; ++i) {
            for (int j = 0; j + (2 << i) - 1 < n; ++j) {
                a[i + 1][j] = func(a[i][j], a[i][j + (1 << i)]);
            }
        }    
    }
    T operator()(int l, int r) const {
        int k = std::__lg(r - l + 1);
        return func(a[k][l], a[k][r - (1 << k) + 1]);
    }
};


template<class T,
    class Cmp = std::less<T>>
struct RMQ {
    const Cmp cmp = Cmp();
    static constexpr unsigned B = 64;
    using u64 = unsigned long long;
    int n;
    std::vector<std::vector<T>> a;
    std::vector<T> pre, suf, ini;
    std::vector<u64> stk;
    RMQ() {}
    RMQ(const std::vector<T> &v) {
        init(v);
    }
    void init(const std::vector<T> &v) {
        n = v.size();
        pre = suf = ini = v;
        stk.resize(n);
        if (!n) {
            return;
        }
        const int M = (n - 1) / B + 1;
        const int lg = std::__lg(M);
        a.assign(lg + 1, std::vector<T>(M));
        for (int i = 0; i < M; i++) {
            a[0][i] = v[i * B];
            for (int j = 1; j < B && i * B + j < n; j++) {
                a[0][i] = std::min(a[0][i], v[i * B + j], cmp);
            }
        }
        for (int i = 1; i < n; i++) {
            if (i % B) {
                pre[i] = std::min(pre[i], pre[i - 1], cmp);
            }
        }
        for (int i = n - 2; i >= 0; i--) {
            if (i % B != B - 1) {
                suf[i] = std::min(suf[i], suf[i + 1], cmp);
            }
        }
        for (int j = 0; j < lg; j++) {
            for (int i = 0; i + (2 << j) <= M; i++) {
                a[j + 1][i] = std::min(a[j][i], a[j][i + (1 << j)], cmp);
            }
        }
        for (int i = 0; i < M; i++) {
            const int l = i * B;
            const int r = std::min(1U * n, l + B);
            u64 s = 0;
            for (int j = l; j < r; j++) {
                while (s && cmp(v[j], v[std::__lg(s) + l])) {
                    s ^= 1ULL << std::__lg(s);
                }
                s |= 1ULL << (j - l);
                stk[j] = s;
            }
        }
    } 
    T operator()(int l, int r) const {
        if (l / B != (r - 1) / B) {
            T ans = std::min(suf[l], pre[r - 1], cmp);
            l = l / B + 1;
            r = r / B;
            if (l < r) {
                int k = std::__lg(r - l);
                ans = std::min({ans, a[k][l], a[k][r - (1 << k)]}, cmp);
            }
            return ans;
        } else {
            int x = B * (l / B);
            return ini[__builtin_ctzll(stk[r - 1] >> (l - x)) + l];
        }
    }
};


template <typename T, typename F>
struct OptimizedST {
    int n; // 数组大小
    int B; // 块大小
    std::vector<std::vector<T>> a; // 块间稀疏表
    std::vector<T> pre, suf, v;
    F func; // 操作函数对象

 public:
    OptimizedST(const std::vector<T>& v, const F &f) : n(v.size()), func(f), v(v), pre(v), suf(v) {
        B = static_cast<int>(std::log2(n)) + 1; // 块大小为 O(log n)
        if (!n) {
            return;
        }
        
        // 预处理每个块的值
        const int M = (n - 1) / B + 1;
        const int lg = std::__lg(M);
        a.assign(lg + 1, std::vector<T>(M));
        for (int i = 0; i < M; i++) {
            a[0][i] = v[i * B];
            for (int j = 1; j < B && i * B + j < n; j++) {
                a[0][i] = func(a[0][i], v[i * B + j]);
            }
        }
        for (int i = 1; i < n; i++) {
            if (i % B) {
                pre[i] = func(pre[i], pre[i - 1]);
            }
        }
        for (int i = n - 2; i >= 0; i--) {
            if (i % B != B - 1) {
                suf[i] = func(suf[i], suf[i + 1]);
            }
        }
        for (int j = 0; j < lg; j++) {
            for (int i = 0; i + (2 << j) <= M; i++) {
                a[j + 1][i] = func(a[j][i], a[j][i + (1 << j)]);
            }
        }
    }
    T operator()(int l, int r) const {
        assert(l >= 0 && r < n && l <= r); // 检查范围合法性

        if (l / B == r / B) {   // 查询区间完全在一个块内
            T ans = v[l];
            for (int i = l + 1; i <= r; ++i) {
                ans = func(ans, v[i]);
            }
            return ans;
        } else {    // 查询区间跨越多个块
            T ans = func(suf[l], pre[r]);
            l = l / B + 1;
            r = r / B;
            for (int i = std::__lg(n); i >= 0; --i) {
                if (l + (1 << i) <= r) {
                    ans = func(ans, a[i][l]);
                    l += 1 << i;
                }
            }
            // l = l / B + 1;
            // r = r / B - 1;
            // int k = std::__lg(r - l + 1);
            // ans = func(ans, a[k][l]);
            // ans = func(ans, a[r - (1 << k) + 1])
            return ans;
        }
    }
};


void solve()
{
    int n, q;
    std::cin >> n >> q;
    std::vector<int> a(n + 1);
    for (int i = 0; i < n; ++ i) {
        std::cin >> a[i];
    }
    // ST<int> stmax(n, a);
    // ST<int> stmin(n, a, [&](int x, int y) {
    //     return std::min(x, y);
    // });
    std::vector<int> b(n);
    for (int i = n - 1; i >= 1; -- i) {
        b[i] = std::abs(a[i] - a[i - 1]);
    }

    for (int i = 0; i < n; ++i) {
        std::cout << b[i] << " \n"[i == n - 1];
    }

    // ST<int> stgcd(n, b, [&](int x, int y) {
    //     return std::gcd(x, y);
    // });

    // RMQ<int> stmin(a);
    // RMQ<int, std::greater<>> stmax(a);

    // std::cout << stmin(0, n) << " sdfsdf\n";

    ST<int, decltype([](int a, int b) {
        return std::gcd(a, b);
    })> stgcd(b);
    // ST<int> st(a);

    // std::cout << stgcd(0, 4) << " dsf\n" << std::endl;

    // int gcd = 0;
    // for (int i = 1; i < 4; ++i) {
    //     gcd = std::gcd(gcd, b[i]);
    // }
    // std::cout << gcd << "\n";

    while (q --) {
        int l, r;
        std::cin >> l >> r;
        --l, --r;
        std::cout << l << " " << r << "\n";
        // std::cout << stgcd(l, r) << " ";
        // std::cout << st(l, r) << "\n";
    }
    std::cout << std::endl;
}
int main()
{
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int T = 1;
    std::cin >> T;
    while (T --) solve();
    return 0;
}
